package com.demoweb.tetris;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.demoweb.model.dao.BoardDao;
import com.demoweb.model.dao.ScoreDao;
import com.demoweb.model.dao.UploadFileDao;
import com.demoweb.model.dao.daesunScoreDao;
import com.demoweb.model.dto.Board;
import com.demoweb.model.dto.Score;
import com.demoweb.ui.*;	
	
	@WebServlet("/tetris/rankinglist2.action")
	public class  Rankingboard  extends HttpServlet {
		private static final long serialVersionUID = 1L;

		protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			
//			int currentPage = 1;
//			int pageSize = 2;
//			int dataCount = 0;
//			int pagerSize = 2;
//			int ScoreList = 0;
//			String url = "Ranklist.action";
//			
//			
//			String page = request.getParameter("pageno");		
//			if (page != null && page.length() > 0) {
//				currentPage = Integer.parseInt(page);
//			}		
//			int startRow = (currentPage - 1) * pageSize;	
			
			//데이터 조회 (목록 조회)
			ScoreDao dao = new ScoreDao();
//<<<<<<< .mine
//			List<Score> scores2= dao.getMembersScore();
//=======
			List<Score> scores= dao.getMembersScore(3);
//>>>>>>> .r112
	
			//조회된 목록을 request 객체에 저장
			request.setAttribute("ranking2", scores);

		
//			//조회된 데이터를 jsp 처리할 수 있도록 request 객체에 저장
//			request.setAttribute("scores", scores);
//			ThePager pager = 
//				new ThePager(dataCount, currentPage, pageSize, pagerSize, url);
//			request.setAttribute("pager", pager);
//			
			RequestDispatcher dispatcher = 
				request.getRequestDispatcher("/WEB-INF/views/tetris/rankinglist2.jsp");

			dispatcher.forward(request, response);
		
		}

		protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			doGet(request, response);
		}

	}
